import {post, get} from "./axios";

// 我的发布
export function myPublish(userId) {
  return get('/user/publishList/'+ userId)
}

export class PublishArticle {
  constructor(article) {
    this.id = article._id
    this.title = article.title
    this.processDesc = article.interview.detail[0].processDesc
    this.feedback = article.feedback
    this.firm = article.baseInfo.firm
    this.position = article.baseInfo.position
    this.publishTime = article.publishTime
    this.interviewTypes = []
    for(let item of article.interview.detail) {
      this.interviewTypes.push(item.interviewType)
    }
  }
}

// 账号设置
export function setAccount(userId, data) {
  return post('/user/account/' + userId, data)
}

// 头像设置
export function uploadAvatar(userId, data) {
  return post('/user/upload/' + userId, data)
}

// 个人信息设置
export function updateMessage(userId, data) {
  return post('/user/personal/' + userId, data)
}

// 获取用户数据
export function getUserInfo(userId) {
  return post('/user/info', userId)
}

// 获取消息列表
export function getMessage(userId) {
  return get('/user/message/' + userId)
}

// 删除面经
export function delInterview(userId) {
  return get('/article/delete/' + userId)
}
